package com.yangye.niodemo.rpc.protocol;

import com.yangye.niodemo.rpc.util.SerDerUtil;
import lombok.Data;

import java.io.Serializable;
import java.util.UUID;

/**
 * @author yangye
 * @date 2020/12/29
 */
@Data
public class RpcHeader implements Serializable {

	private Long requestId;

	private Long bodyLen;

	public static RpcHeader createHeader(long bodyLen) {
		long requestId = Math.abs(UUID.randomUUID().getLeastSignificantBits());

		RpcHeader header = new RpcHeader();
		header.setRequestId(requestId);
		header.setBodyLen(bodyLen);
		return header;
	}
}
